﻿<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-access="property" default-lazy="true" namespace="Cms.Domain" assembly="Cms.Domain">
  <class name="Page" table="cmsPage">
    <cache usage="read-write" />
    <id name="ID" unsaved-value="0" column="ID" type="System.Int32">
      <generator class="identity" />
    </id>
    <property name="Filename" column="PageFilename" not-null="true" type="System.String" />
    <property name="Name" column="PageName" not-null="true" type="System.String" />
    <many-to-one name="Site" column="SiteID" not-null="true" />
    <many-to-one name="Folder" column="FolderID" not-null="false" />
    <many-to-one name="MasterTemplate" column="MasterTemplateID" not-null="true" />
    <many-to-one name="DetailTemplate" column="DetailTemplateID" not-null="true" />
    <property name="StartPublishing" column="PageStartPublishing" not-null="false" type="System.DateTime" />
    <property name="EndPublishing" column="PageEndPublishing" not-null="false" type="System.DateTime" />
    <property name="HeadHtml" column="HeadHtml" not-null="false" type="System.String" length="1000000" />
    <property name="BodyTopHtml" column="BodyTopHtml" not-null="false" type="System.String" length="1000000" />
    <property name="BodyBottomHtml" column="BodyBottomHtml" not-null="false" type="System.String" length="1000000" />
    <property name="SortKey" column="SortKey" not-null="false" type="System.String" />
    <property name="Hits" column="Hits" not-null="true" type="System.Int32" />
    <bag name="Content" cascade="all-delete-orphan" table="cmsPageContent" inverse="true">
      <cache usage="read-write" />
      <key column="PageID" />
      <one-to-many class="PageContentLink" />
    </bag>
    <map name="ContentSets" table="cmsPageContentSet" inverse="true" cascade="all-delete-orphan">
      <cache usage="read-write" />
      <key column="PageID" />
      <index column="LocaleID" type="System.Int32" />
      <one-to-many class="PageContentSet" />
    </map>
    <bag name="AdminVisits" cascade="all-delete-orphan" inverse="true" table="cmsVisitedPublicUrl">
      <cache usage="read-write" />
      <key column="PageID" />
      <one-to-many class="VisitedPublicUrl" />
    </bag>
    <bag name="Categories" table="cmsPageCategory" mutable="true">
      <cache usage="read-write" />
      <key column="PageID" />
      <many-to-many class="Category" column="CategoryID" />
    </bag>
    <bag name="AllowedAdministratorGroups" table="cmsAdministratorGroupAllowedPage" mutable="true">
      <cache usage="read-write" />
      <key>
        <column name="PageID" />
      </key>
      <many-to-many class="AdministratorGroup">
        <column name="GroupID" />
      </many-to-many>
    </bag>
    <bag name="DeniedAdministratorGroups" table="cmsAdministratorGroupDeniedPage" mutable="true">
      <cache usage="read-write" />
      <key>
        <column name="PageID" />
      </key>
      <many-to-many class="AdministratorGroup">
        <column name="GroupID" />
      </many-to-many>
    </bag>
    <bag name="RequiredUserGroups" table="cmsPageRequiredUserGroup" mutable="true">
      <cache usage="read-write" />
      <key>
        <column name="PageID" />
      </key>
      <many-to-many class="UserGroup">
        <column name="GroupID" />
      </many-to-many>
    </bag>
    <bag name="DeselectedUserGroups" table="cmsPageDeselectedUserGroup" mutable="true">
      <cache usage="read-write" />
      <key>
        <column name="PageID" />
      </key>
      <many-to-many class="UserGroup">
        <column name="GroupID" />
      </many-to-many>
    </bag>
    <bag name="MenuItems" cascade="all-delete-orphan" inverse="true" table="cmsMenuItem">
      <cache usage="read-write" />
      <key column="PageID" />
      <one-to-many class="MenuItem" />
    </bag>
    <bag name="Comments" cascade="all-delete-orphan" inverse="true" table="cmsComment">
      <cache usage="read-write" />
      <key column="PageID" />
      <one-to-many class="Comment" />
    </bag>
    <map name="LocalizedProperties" table="cmsPageLocalizedProperty" fetch="join">
      <cache usage="read-write" />
      <key column="PageID" />
      <index column="LocaleID" type="System.Int32" />
      <composite-element class="PageLocalizedProperties">
        <property name="Title" column="Title" type="System.String" not-null="false" />
        <property name="Description" column="Description" type="System.String" not-null="false" length="1000000" />
        <property name="Keywords" column="Keywords" type="System.String" not-null="false" length="1000000" />
        <property name="ListingsTitle" column="ListingsTitle" type="System.String" not-null="false" />
        <property name="ListingsDescription" column="ListingsDescription" type="System.String" not-null="false" length="1000000" />
      </composite-element>
    </map>
    <joined-subclass name="ApplicationPage" table="cmsApplicationPage">
      <key column="PageID" />
      <many-to-one name="Application" column="ApplicationID" not-null="true" cascade="all" />
      <many-to-one name="SourceCode" column="SourceCodeID" not-null="false" cascade="all" />
      <map name="Areas" cascade="all" table="cmsApplicationPageArea">
        <cache usage="read-write" />
        <key column="PageID" />
        <index column="AreaID" type="System.String" />
        <many-to-many column="SourceCodeID" class="SourceCode" />
      </map>
    </joined-subclass>
  </class>
</hibernate-mapping>